import socket


if __name__ == '__main__':
    # 创建socket  并且socket.AF_INET代表是ipv4   socket.SOCK_STREAM代表是tcp协议
    socTest = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    socTest.connect(("127.0.0.1",8080))
    socTest.send("hay".encode())
    while True:
        re = socTest.recv(1204)
        print(re.decode())
    socTest.close()